<template>
    <div class="privacy">
        <div class='moduleHead'>
            <router-link :to="{name:'setting'}">
                <span class="back"></span>
            </router-link>
            <span> {{language.privacy_title}} </span>
        </div>
        <div class="body">
            <div class="title">{{language.privacy_profileVisibility}}</div>
            <div class="list_warapper">
                <ul>
                    <li @click="toPage('serviceAgreement')">
                        <span>{{language.privacy_hideFromAll}}</span>
                        <span @click.stop="setProfileState" class="r">
                            <OnOff :propsStatus="getProfileStatus"></OnOff>
                        </span>
                    </li>
                </ul>
            </div>
            <div class="desc">{{language.privacy_hideFromAllNote}}</div>
            <div class="list_warapper">
                <ul>
                    <li @click="toPage('blockedMembers')">
                        <span>{{language.privacy_blockedMembers}}</span>
                    </li>
                </ul>
            </div>
            <div class="accountChange">
                <router-link :to="{name:'deleteProfile'}">
                    {{language.privacy_deleteProfile}}<i></i>
                </router-link>
            </div>
        </div>
        <loading :props="{type:'page' ,show:loadingAjax}"></loading>
    </div>
</template>
<script>
import OnOff from './OnOff'
import loading from './Loading'

export default {
    name: 'privacy',
    data() {
        return {
            loadingAjax: false,
        }
    },
    components: {
        OnOff,
        loading
    },

    computed: {
        getProfileStatus() {
            return this.$store.state.user.userInfo.account.hidden;
        }
    },
    methods: {
        setProfileState() {
            let obj = {},
                tthis = this;
            obj.data = {
                hide: this.getProfileStatus == 0 ? 1 : 0
            };
            obj.callback = function() {};
            obj.complete = function() {
                tthis.loadingAjax = false;
            };
            this.loadingAjax = true;
            this.$store.dispatch('user_updateProfileStatus', obj);
        },
        toPage(url) {
            this.$router.push({
                name: url
            });
        },
    }
}

</script>
<style scoped>
.privacy {
    padding-top: 44px;
    background-color: #f7f7f7;
}

.privacy .body {
    padding-top: 12px;
}

.privacy .title {
    padding: 0 20px;
    line-height: 40px;
    color: #282828;
    font-size: 17px;
}

.privacy .desc {
    padding: 0 20px 14px 20px;
    margin-top: -8px;
    font-size: 12px;
    color: #4a4a4a;
}

.privacy .accountChange {
    line-height: 40px;
    color: #656565;
    text-align: center;
    text-indent: -12px;
}

.privacy .accountChange i {
    position: relative;
    display: inline-block;
}

.privacy .accountChange i::after,
.privacy .accountChange i::before {
    position: absolute;
    top: -12px;
    right: -14px;
    content: '';
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 7px solid #c7c7cc;
}

.privacy .accountChange i::after {
    right: -12px;
    border-left-color: #f7f7f7;
}

.privacy .list_warapper {
    font-size: 16px;
    margin-bottom: 16px;
    background-color: #fff;
    color: #757575;
    padding: 0 0 0 20px;
}

.privacy .list_warapper li {
    position: relative;
    line-height: 46px;
}

.privacy .list_warapper li .r {
    position: relative;
    z-index: 1;
    padding: 0 10px 0 0;
    margin-top: -1px;
    float: right;
}

.privacy .list_warapper li a {
    display: block;
}

.privacy .list_warapper li::after,
.privacy .list_warapper li::before {
    position: absolute;
    top: 50%;
    right: 18px;
    margin-top: -7px;
    content: '';
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 7px solid #c7c7cc;
}

.privacy .list_warapper li::after {
    right: 20px;
    border-left-color: #fff;
}

.privacy .list_warapper li:last-child {
    border-bottom: 0;
}

.privacy .version {
    color: #666;
    padding: 60px 0;
    text-align: center;
    font-size: 12px;
    line-height: 24px;
}

.privacy .version p {
    font-size: 14px;
}

</style>
